﻿using System;
using System.Collections.Generic;
using System.Drawing;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using System.Windows.Forms;

namespace laohan.Common.reporter
{
    /// <summary>
    /// 报表列属性
    /// </summary>
    public class ColumnAttr
    {
        /// <summary>
        /// 
        /// </summary>
        public string Name { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public string HeaderText { get; set; }

        /// <summary>
        /// 
        /// </summary>
        public int Width { get; set; } = 85;

        /// <summary>
        /// 
        /// </summary>
        public DataGridViewContentAlignment Align { get; set; } = DataGridViewContentAlignment.MiddleCenter;

        /// <summary>
        /// 
        /// </summary>
        public ColumnAttrDataType DataType { get; set; } = ColumnAttrDataType.attr_string;

        /// <summary>
        /// 
        /// </summary>
        public ColumnType TypeFlag { get; set; } = ColumnType.Nomal;

        /// <summary>
        /// 
        /// </summary>
        public bool Visible { get; set; } = true;

        /// <summary>
        /// 
        /// </summary>
        public bool ReadOnly { get; set; } = true;

        /// <summary>
        /// 
        /// </summary>
        public Color BackColor { get; set; } = Color.White;

        /// <summary>
        /// 
        /// </summary>
        public Color ForeColor { get; set; } = Color.Black;

        /// <summary>
        /// 
        /// </summary>
        public ColumnAttr()
        {
            this.Visible = true;
            this.ReadOnly = true;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        /// <param name="align"></param>
        /// <param name="visible"></param>
        /// <param name="readOnly"></param>
        public ColumnAttr(string name, string headerText, int width, DataGridViewContentAlignment align, bool visible = true, bool readOnly = true)
        {
            this.Name = name;
            this.HeaderText = headerText;
            this.Width = width;
            this.Align = align;
            this.Visible = visible;
            this.ReadOnly = readOnly;
            this.BackColor = Color.Transparent;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        /// <param name="align"></param>
        /// <param name="visible"></param>
        /// <param name="readOnly"></param>
        /// <param name="backColor"></param>
        public ColumnAttr(string headerText, int width, DataGridViewContentAlignment align, ColumnType columnType, ColumnAttrDataType dataType,
            Color backColor, Color foreColor, bool visible = true, bool readOnly = true)
        {
            this.HeaderText = headerText;
            this.Width = width;
            this.Align = align;
            this.TypeFlag = columnType;
            this.DataType = dataType;
            this.Visible = visible;
            this.ReadOnly = readOnly;
            this.BackColor = backColor;
            this.ForeColor = foreColor;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="headerText"></param>
        public ColumnAttr(string name, string headerText)
        {
            this.Name = name;
            this.HeaderText = headerText;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        public ColumnAttr(string name, string headerText, int width)
        {
            this.Name = name;
            this.HeaderText = headerText;
            this.Width = width;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        /// <param name="visible"></param>
        public ColumnAttr(string name, string headerText, int width, bool visible)
        {
            this.Name = name;
            this.HeaderText = headerText;
            this.Width = width;
            this.Visible = visible;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        /// <param name="columnType"></param>
        public ColumnAttr(string name, string headerText, int width, ColumnType columnType, bool visible = true)
        {
            this.Name = name;
            this.HeaderText = headerText;
            this.Width = width;
            this.TypeFlag = columnType;
            this.Visible = visible;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        /// <param name="visible"></param>
        /// <param name="columnType"></param>
        public ColumnAttr(string name, string headerText, int width, bool visible, ColumnType columnType)
        {
            this.Name = name;
            this.HeaderText = headerText;
            this.Width = width;
            this.Visible = visible;
            this.TypeFlag = columnType;
        }

        /// <summary>
        /// 
        /// </summary>
        /// <param name="name"></param>
        /// <param name="headerText"></param>
        /// <param name="width"></param>
        public ColumnAttr(string name, string headerText, bool visible)
        {
            this.Name = name;
            this.HeaderText = headerText;
            this.Visible = visible;
        }
    }

    /// <summary>
    /// 
    /// </summary>
    public enum ColumnAttrDataType
    {
        /// <summary>
        /// 
        /// </summary>
        attr_int,

        /// <summary>
        /// 
        /// </summary>
        attr_string,

        /// <summary>
        /// 
        /// </summary>
        attr_decimal,
    }

    /// <summary>
    /// 
    /// </summary>
    public enum ColumnType
    {
        /// <summary>
        /// 正常数据类型
        /// </summary>
        Nomal = 1,

        /// <summary>
        /// 按钮
        /// </summary>
        Button = 2,

        /// <summary>
        /// 下拉列表
        /// </summary>
        Combobox = 3,

        /// <summary>
        /// CheckBox
        /// </summary>
        CheckBox = 4,

        /// <summary>
        /// 
        /// </summary>
        Tree = 5,

        /// <summary>
        /// 
        /// </summary>
        TextBox = 6,
    }
}